package com.google.bitcoin.fees;

import com.google.bitcoin.core.Transaction;

import java.math.BigInteger;

/**
 * A FeeSchedule must compute a transaction fee to be added to a transaction.
 */
public interface FeeSchedule
{
    // TODO: This method is being called prior to gathering outputs into
    // the transaction, but the ultimate intent is to call this after
    // gathering initial outputs (which might then require another round
    // of gathering outputs to cover the fee, then this method is called
    // again... and repeat until total spend+fee covered by outputs).
    //
    /**
     * Get the fee to be included with the transaction.
     *
     * @param sendTx transaction to be sent; if <tt>null</tt> the fee
     * schedule should return a best-guess fee (or throw an exception if
     * incapable of computing a guess)
     *
     * @return non-null transaction fee (in nanocoins)
     *
     * @throws FeeException if a fee cannot be computed
     */
    public BigInteger getFee(Transaction sendTx) throws FeeException;
}
